import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import All from '../views/All.vue'
import Product from '../views/Product.vue'
import Newspaper from '../views/Newspaper.vue'
import Leamsc from '../views/Leamsc.vue'
import Connect from '../views/Connect.vue'
import Detil from '../views/Detil.vue'
import Phone from '../views/Phone.vue'
import Pc from '../views/Pc.vue'
import Specific from '../views/Specific.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    // exact:false,
    component: Home
  },
  {
    path: '/login',
    name: 'Login',
    // exact:false,
    component: ()=>import('../views/Login')
  },
 
  {
    path: '/about',
    name: 'About',
    mate:{
      cname:'关于我们'
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },

  {
    path: '/product',
    name: 'Product',
    component: Product,
    children:[{
      path: 'detil',
      name: 'Detil',
      component: Detil,
      children:[{
        path:'phone',
        name:'Phone',
        component:Phone,
      },
      {
        path:'pc',
        name:'Pc',
        component: Pc,
      },
      {
        path:'specific',
        name:'Specific',
        props:true,
        component: Specific,
      },
    ]
    }]
  },
  {
    path: '/newspaper',
    name: 'Newspaper',
    component: Newspaper
  },
  {
    path: '/leamsc',
    name: 'Leamsc',
    component: Leamsc
  },
  {
    path: '/connect',
    name: 'Connect',
    component: Connect
  },
  {
    path: '*',
    name: 'All',
    component: All
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
